﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Glucometer
{
    public partial class BlinkingLabel : UserControl
    {
        private Timer _blinkingTimer;

        public BlinkingLabel()
        {            
            InitializeComponent();

            _blinkingTimer = new Timer();
            _blinkingTimer.Tick += new EventHandler(_blinkingTimer_Tick);
        }

        void _blinkingTimer_Tick(object sender, EventArgs e)
        {
            label1.Visible = !label1.Visible;
        }

        public void startBlinking(int blinkRate)
        {
            _blinkingTimer.Interval = 1000 / blinkRate;
            _blinkingTimer.Start();
        }

        public void stopBlinking()
        {
            _blinkingTimer.Stop();
            label1.Visible = true;
        }
        
        public string Text
        { 
            get { return label1.Text; }
            set { label1.Text = value; }
        }
    }
}